#!/bin/bash
# 安装Java
echo "开始执行安装Java命令"
if ! which java 2>/dev/null; then
  sudo apt install openjdk-9-jdk -y
fi
if ! grep JAVA_HOME /etc/profile 2>/dev/null; then
    echo 'export  JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"' >> /etc/profile
    echo 'export  JRE_HOME=$JAVA_HOME/lib' >> /etc/profile
    echo 'export  PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile
fi
sudo source /etc/profile
